In order to understand the Bible it is crucial to know the differences between the two main teachings of the Bible, Law and Gospel.
The law is the message that all sin condemns us before God absolutely. So Paul quotes Deuteronomy, Galatians 3:10, “Cursed is everyone who does not continue to do everything written in the Book of the Law.” The Psalmists also lay out the futility of trusting in our own righteousness. Consider Psalm 130:3, “If you, O LORD, kept a record of sins, O Lord, who could stand?” and Psalm 5:5, “The arrogant cannot stand in your presence; you hate all who do wrong.”
The law leaves no room for sin or sinners.
The Gospel, on the other hand is the good news of what God has done through our Savior Jesus Christ to meet the demands of the law on our behalf. John tells us, 1 John 2:2, “He is the atoning sacrifice for our sins, and not only for ours but also for the sins of the whole world.” Paul tells us, Romans 4:25, “He was delivered over to death for our sins and was raised to life for our justification.”
Those who trust in their own righteousness need to hear the law, so that they understand that they stand condemned before God and despair of their own righteousness.
Those who despair of their own righteousness must be pointed to Christ, who is our atoning sacrifice, and has taken away the sins of the world.
So Jesus preaches the law to the Pharisees who were really “pretty good” guys, and preaches the gospel to for tax collector, the corrupt and thieving public official. The former were taught to despair of themselves. Those in despair are taught to trust in Christ.
Are you facing the fact that your sins condemn you before God? Then let me assure you with the words of gospel truth: For the sake of Christ, all your sins are forgiven.