The final two verses of this first chapter of James contain a contrast between vain religion and pure religion.
First, vain (useless) religion is a religion that does not change a person for the better. Specifically, James describes one who thinks himself to be religious, but it has not touched his tongue (or his heart), cf. Matthew 15:18.
Second, pure (and undefiled) religion is characterized by both what is not done, and what is done. One whose religion is pure will show it by righteousness. He will keep himself “unspotted from the world,” cf. 1 Peter 4:3. Additionally, he does his duty, what God requires of Him. He visits “orphans and widows in their trouble,” cf. Galatians 6:10.
Simply put, our religion must first be true (accepting Jesus Christ as the Anointed, the Son of God), and also life changing. We must be a “new creation” (2 Corinthians 5:17), living our lives according to Jesus’ own will (Galatians 2:20).