it seems you copied that formatted text including the background colro froma different source (e.g. another listing) and simply pasted it into the Preview.
In future try to use "paste and match style" from the Edit menu to paste the copied text.
For now, what you can try to reset all styles is to copy the whole text in Preview, switch to Editor mode, delete all your text/code there and then paste your previously copied text. If done switch to Preview and start formatting the text, if needed.