The purity spoken of in this beatitude is referred to many times throughout the Bible in those verses wherein God is a refiner removing the dross from silver or gold; and in those verses in the New Testament wherein it is said that Christ and His Spirit will baptize with fire [like a refiner removing dross] through affliction, suffering, or testing.
Consider the following scriptures: Mal 3:2 “But who will be able to endure it when He comes? Who will be able to stand and face Him when He appears? For He will be like a blazing fire that refines metal, or like a strong soap that bleaches clothes. Mal 3:3 He will sit like a refiner of silver, burning away the dross. He will purify the Levites, refining them like gold and silver, so that they may once again offer acceptable sacrifices to the LORD
[The Free Bible software, E-sword, gives the following references in the commentary, Treasury of Scriptural Knowledge, for Malachi 3:3: Psa_66:10; Pro_17:3, Pro_25:4; Isa_1:25, Isa_48:10; Jer_6:28-30; Eze_22:18-22; Dan_12:10; Zec_13:9; Luk_3:16; Eph_5:26-27; Tit_2:14; Heb_12:10; 1Pe_1:7, 1Pe_4:12-13; Rev_3:18, I pasted in a few of these verses below.]
Isa 1:25 I will raise My fist against you. I will melt you down and skim off your slag. I will remove all your impurities.
Luk 3:16 John answered their questions by saying, “I baptize you with water; but someone is coming soon who is greater than I am—so much greater that I’m not even worthy to be His slave and untie the straps of His sandals. He will baptize you with the Holy Spirit and with fire.
1Pe 1:7 These trials will show that your faith is genuine. It is being tested as fire tests and purifies gold—though your faith is far more precious than mere gold. So when your faith remains strong through many trials, it will bring you much praise and glory and honor on the day when Jesus Christ is revealed to the whole world.
So, in other words, God is the great Refiner; He sends trials to afflict us which is like putting gold in a fire to remove its impurities, to make it free of impurities, pure. That is what He is doing to our hearts via the afflictions, the suffering.
Where is our heart located? See if you can establish that while you read a few verses on the heart from scripture:
Mat 15:8 This people draweth nigh unto me with their mouth, and honoureth me with their lips; but their heart is far from me.
Mat 15:18 But those things which proceed out of the mouth come forth from the heart; and they defile the man. Mat 15:19 For out of the heart proceed evil thoughts, murders, adulteries, fornications, thefts, false witness, blasphemies:
Mat 12:35 A good man out of the good treasure of the heart bringeth forth good things: and an evil man out of the evil treasure bringeth forth evil things.
Act 5:3 But Peter said, Ananias, why hath Satan filled thine heart to lie to the Holy Ghost, and to keep back part of the price of the land? Act 5:4 Whiles it remained, was it not thine own? and after it was sold, was it not in thine own power? why hast thou conceived this thing in thine heart? thou hast not lied unto men, but unto God.