Jas 1:26 If anyone thinks he is religious and does not bridle his tongue but deceives his heart, this person's religion is worthless.
Jas 1:27 Religion that is pure and undefiled before God the Father is this: to visit orphans and widows in their affliction, and to keep oneself unstained from the world.
The word, "Religion' simply means, "to worship God"
thrēskeía; gen. thrēskeías, fem. noun from thrēskeúō (n.f.), to worship God, which is from thrḗskos (G2357), religious, pious. Worshiping or worship.
It appears that what a person "says' out of his mouth is connected to pure religion (to worship God) that is undefiled before God. So, if a person visits orphans, and widows in their affliction, and does not "bridle" his tongue, his acts, which seem to be good to everyone, and to himself are defiled and worthless!
I do remember Jesus saying that it is not what goes into a man that defiles him but what comes out of him. (Mark 7:15)
I think James pretty much said the same thing.
Jas 3:2 For we all stumble in many ways. And if anyone does not stumble in what he says, he is a perfect man, able also to bridle his whole body.
How can a man worship God (be religious) and not bridle his tongue in which he uses to worship God?