Mark records that Jesus, as He enters the synagogue, angrily gazes at the Pharisees in their sin of callousness toward human suffering. Having a full measure of the Holy Spirit, He can discern their evil hearts. With severe and stern indignation, He reacts to their hypocrisy and hardness of heart.
However, His is not a spiteful or revengeful reaction but intense sorrow at their state of mind. Mark phrases it as "being grieved for the hardness of their hearts." It is not hatred of men but anger at the sin they exhibited combined with the passionate sadness that not even His teaching, God's law, or any other means could overcome their confirmed wickedness.
This type of anger is not sin because it is controlled, without hatred, short-lived, and justified due to their defiance of God. Anger is lawful only when it is tempered with sorrow for those who have offended. Paul warns, "'Be angry, and do not sin': do not let the sun go down on your wrath" (Ephesians 4:26).