preg_replace() is the function you need.
Assuming you want to identify and replace the hex representations of colors, the code is something along the lines:
$answer = preg_replace('/<td style="background-color:#[0-9A-F]{6};">/i', '', $answer);
The i PCRE modifier tells preg_replace to ignore character cases.
It identifies and replaces only when the color code contains exactly 6 hex digits. In order to make it identify color codes using the 3-digit RGB notation you need to change the [0-9A-F]{6} part of the regexp to [0-9A-F]{3}([0-9A-F]{3})?. Or use a simpler expression that matches all color codes between 3 and 6 digits: [0-9A-F]{3,6}
You could also put \s* after the colon (:) to make it also match when one or more whitespaces are present after the background-color: part.
The updated code is:
$answer = preg_replace(
'/<td style="background-color:\s*#[0-9A-F]{3,6};">/i', '', $answer
);
However, if you want to match only some colors then you can put the color codes separated by | instead:
$answer = preg_replace(
'/<td style="background-color:\s*#(80F9CC|E1E3E4|D1D3D4|73F6AB|3CEB88);">/i',
'',
$answer
);
Short explanation of the regular expression pieces:
<td style="background-color: # plain text, matches if exact
\s* # matches zero or more (*) space characters (\s)
# # plain text, matches exactly one '#'
( # start of a group, doesn't match anything
80F9CC # matches '80F9CC'
|E1E3E4 # or (|) 'E1E3E4'
|D1D3D4 # or 'D1D3D4'
|73F6AB # or ...
|3CEB88 # or ...
) # end of the group
;"> # plain text; matches exactly this text
<td>with a blank''then you are left with a close</td>tag without its opening tag, leading to bad HTML. Is this really what you want?