In its simplest form, you could do something like this:
$params['body'] = str_replace("text to replace", "replace with this", $params['body']);
...but if you need to replace the text conditionally it becomes more complicated and goes beyond the scope of support.