When Jesus said, “pure of heart” he was drawing attention away from the obsession with external purification rituals of the Pharisees. He focuses on the heart, but their external approach kept their hearts from being truly pure. Jesus even called them “white-washed tombs” that are pretty on the outside, but inside, they are full of dead men’s bones!
This was the difference b/t Christ’s attitude to sinners and that of the Pharisees. Jesus associated with sinners in order to radiate upon them and their faults the merciful purity of the love of God, and so to heal them, while the Pharisees feared contamination. (Servais Pinckaers, O.P., Sources of Christian Ethics)
Purity means freedom from compromise, especially with sin. The only way you can do that is by building of the habit of consistently choosing God above all other things, even if it comes at a great personal cost.