"=" beginning a line sends the rest of the line to WolframAlpha.com.
Mathematica displays the beginning "=" in orange to show the rest of the line was sent to WolframAlpha.com. WolframAlpha.com does not understand or support function definitions.
Try the same without pressing "=" at the beginning of the line.
That will send the line to Mathematica, which is different, and understands function definitions.