How to prevent comment posting when it has specific words in it?
You can try Spam module.

It runs filters on posted content, for example using regexps.

Another way is to write a Rule that examines posted comments and deny them if certain words are found, but unfortunately this module is only available for Drupal 6.

And also you can write a validate function to the comment form, examine the content on submission and use form_set_error if you detect those words. To do this just implemente the hook_form_alter (or the hook form alter with form id), add your valditation function:

$form['#validate'][] = 'you_custom_validate_function';