To condense it all into a nutshell, if you're doing it for show, if you're doing it to impress people, it doesn't count in God's sight. What you do in secret, for God, in accord with God's Word, is what pleases God. And I believe this is what true humility is all about.
The Pharisees did what they did with the primary motive of impressing those around them, but their hearts were far from God. They substituted their own traditions for the Word of God, laying heavy burdens on others but not offering any help themselves. They prayed long prayers on street corners to impress others of how pious they were, but foreclosed on widow's houses. They had people to blow trumpets before them when they put their money into the treasury so everyone could see how generous they were. But they only gave of their surplus. Jesus' most scathing rebukes were reserved for these hypocrites, accordingly. And this also is why he told them harlots and tax collectors would go into the kingdom ahead of them, because they would see their sorry condition and repent, while the hypocritical pharisees would only justify themselves and look down on others.
The parable of the Pharisee and the publican I think most graphically illustrates this differencel