At this age, your child hears a lot of things in school and he also understands the meaning of it. The best way to deal with this behavior is to ignore it, and at the same time tell him not to repeat these words again as he knows the meaning of it. You must let your child know that this 'word' should not used by him at all. Teach your little one that calling names hurts people’s feelings and make them sad.
What you need to know
Discuss with him that thhose kind of words will not be tolerated, warn your child of bad-word consequences before he tries to use another one and enforce those consequences every time you hear bad language. You can also try some creative techniques, such as skipping a meal or avoiding TV for an hour or two, every time he uses these words. You must also praise your child for not using foul language. Your child may have heard bad language at home, so practice what you preach. Apologize if you accidentally let a bad word slip out. This will make him understand that even grown-ups are not allowed to use these words.