You'll need to save the "forbidden" words inside a string array.
Then you'll have to create an algorithm that checks the entered chat string for words contained within the entered chat string that equals the string array.
This can be done through character positions. You'll need to loop through them. You can then show the filtered chat string to the players.
It's not easy to script this...
I'm sorry but I don't have enough time to do this for you.
Do you have experience with Jass?
It's probably easier doing this in Jass then in GUI.
I can give you guidelines, but that's all I can do for now.
About the chat log: I'm not sure if this is possible, I'll have to look around...