"To some who were confident of their own righteousness and looked down on everybody else, Jesus told this parable: 'Two men went up to the temple to pray, one a Pharisee and the other a tax collector. The Pharisee stood up and prayed about [to] himself: 'God, I thank you that I am not like other men—robbers, evildoers, adulterers—or even like this tax collector. I fast twice a week and give a tenth of all I get'."
"But the tax collector stood at a distance. He would not even look up to heaven, but beat his chest and said,
'God, have mercy on me, a sinner!'
"I tell you that this man, rather than the other, went home justified before God. For everyone who exalts himself will be humbled, and he who humbles himself will be exalted." - Luke 18:9-12
"This parable was to convince some who trusted in themselves that they were righteous, and despised others. God sees with what disposition and design we come to him in holy ordinances. What the Pharisee said, shows that he trusted to himself that he was righteous. We may suppose he was free from gross and scandalous sins. All this was very well and commendable. Miserable is the condition of those who come short of the righteousness of this Pharisee, yet he was not accepted; and why not? He went up to the temple to pray, but was full of himself and his own goodness; the favour and grace of God he did not think worth asking.
Let us beware of presenting proud devotions to the Lord, and of despising others. The publican's address to God was full of humility, and of repentance for sin, and desire toward God. His prayer was short, but to the purpose; God be merciful to me a sinner.
Blessed be God, that we have this short prayer upon record, as an answered prayer; and that we are sure that he who prayed it, went to his house justified; for so shall we be, if we pray it, as he did, through Jesus Christ. He owned himself a sinner by nature, by practice, guilty before God. He had no dependence but upon the mercy of God; upon that alone he relied. And God's glory is to resist the proud, and give grace to the humble. Justification is of God in Christ; therefore the self-condemned, and not the self-righteous, are justified before God."
- Matthew Henry's Commentary