From: Luke 18:9-14
Parable of the Pharisee and the Tax Collector
 He (Jesus) also told this parable to some who trusted in themselves that they were righteous and despised others:  "Two men went up into the temple to pray, one a Pharisee and the other a tax collector.  The Pharisee stood and prayed thus with himself, `God, I thank Thee that I am not like other men, extortioners, unjust, adulterers, or even like this tax collector.  I fast twice a week, I give tithes of all that I get.'  But the tax collector, standing far off, would not even lift up his eyes to Heaven, but beat his breast, saying, `God, be merciful to me a sinner!'  I tell you, this man went down to his house justified rather than the other; for every one who exalts himself will be humbled, but he who humbles himself will be exalted."
9-14. Our Lord here rounds off His teaching on prayer. In addition to being persevering and full of faith, prayer must flow from a humble heart, a heart that repents of its sins: "Cor contritum et humiliatum, Deus, non despicies" (Psalm 51:19); the Lord, who never despises a contrite and humble heart, resists the proud and gives His grace to the humble (cf. Peter 5:5; James 4:6).
The parable presents two opposite types--the Pharisee, who is so meticulous about external fulfillment of the Law; and the tax collector, who in fact is looked on as a public sinner (cf. Luke 19:7). The Pharisee's prayer is not pleasing to God, because his pride causes him to be self-centered and to despise others. He begins by giving thanks to God, but obviously it is not true gratitude, because he boasts about all the good he has done and he fails to recognize his sins; since he regards himself as righteous, he has no need of pardon, he thinks; and he remains in his sinful state; to him also apply these words spoken by our Lord to a group of Pharisees on another occasion: "If you were blind, you would have no guilt; but now that you say, `We see,' your guilt remains" (John 9:41). The Pharisee went down from the temple, therefore, unjustified.
But the tax collector recognizes his personal unworthiness and is sincerely sorry for his sins: he has the necessary dispositions for God to pardon him. His ejaculatory prayer wins God's forgiveness: "It is not without reason that some have said that prayer justifies; for repentant prayer or supplicant repentance, raising up the soul to God and re-uniting it to His goodness, without doubt obtains pardon in virtue of the holy love which gives it this sacred movement. And therefore we ought all to have very many such ejaculatory prayers, said as an act of loving repentance and with a desire of obtaining reconciliation with God, so that by thus laying our tribulation before our Savior, we may pour out our souls before and within His pitiful heart, which will receive them with mercy" (St. Francis de Sales,
"Treatise on the Love of God", Book 2, Chapter 20).
Source: "The Navarre Bible: Text and Commentaries". Biblical text taken from the Revised Standard Version and New Vulgate. Commentaries made by members of the Faculty of Theology of the University of Navarre, Spain. Published by Four Courts Press, Kill Lane, Blackrock,Co. Dublin, Ireland.