As noted below notebook files, .nb, are text but they have a great deal of metadata, input, output and lots of "noise"
If you want to compare the input lines in 2 notebooks, go to File/Save As and save the notebooks as "wolfram language script". The .wls is very clean and easy to compare with any line-by-line text compare tool.
At least in version 14.0 File/Save as "text" doesn't differentiate input and output, and contains all output from when the notebook last ran. It is very noisy.
Each section of inputs in the .wls file from a notebook begins with
(* ::Input:: *)
--- various input lines ---
(**)
It often ends before the (*) but sometimes the input lines are after the ( *)
There are sections for explicitly printed lines that begin with (* ::Print:: *)
Git diff works really well. Any command-line tool you know will work.