How can kibana compare two fields?

It looks like you've put the formula into the runtime_fields editor.

Formulas are a Lens specific feature: