This is a simple suggestion. It could help with a lot, but in general, mostly against bots spamming. The idea is the following, through the Chat options, there could be a custom chat filter option, in which, the player could set up specific words. Then a list of exceptions: Friends, Alliance and etc. Any chat message containing any of those word would be automatically filtered out for the player that sets up the rule. No sound, no pop up, nothing. Unless the person writing the message is one of the "trusted" sources that can use that given word in their messages.
This function could be used for a lot. Bots are a primary example. Another would be parents speaking foreign languages who could set up their own profanity filters for their children. Etc-etc. It would be a greatly useful addition.