Problem:
If([Appraisal Received]=true, (ToDays(([Appraisal Due Date]-[Appraisal Received Date]))))
-------------------------------------------
Solution:
Because the desired result is a rich text, the best route would be to create a formula - Rich Text field.
It's also best to define variables to separate and define the segments of the argument.
Also, a solution to get a red background with white font would be to use a <p> tag with style attribute and concatenate into the formula.
Try the following:
-------------------------------------------
Var Duration Days = ToDays([Appraisal Due Date]-[Appraisal Received Date]);
Var text Output1 = ToText($Days);
If($Days <= 0, "ON TIME", "<p style='background-color:red;color:white'>"+$Output1+"</p>");
---------
this may not work initially due to some possible syntax errors but this should point you in the right direction.