Google Sheets could be expanded to implement "a formula approach" for certain tasks. This is called "custom functions".
Custom functions should only be used to display values, so they should not be used to set the conditional formating directly. Instead use the conditional formatting built-in feature.
Best Answer
You're looking for the IF command, combined with NE (not equal):