you could use output each of those files into a files that have
a single line only, then compare the one-line files.
In other words, you replace the new line character by one space and you
remove extra spaces.
A seder could do that for you.
Example
###copy and paste to seder.sed below this line
#!/bin/sed -f
:loop
N
$!b loop
s?[ \t\n]\{1,\}? ?g
#### end of copy ####
After you pasted this to a sed script file (eg seder.sed) you make the
script executable:
chmod +x seder.sed
Now, let's say the two files you want to compare are file1.txt and file2.txt.
You run these commands:
./seder.sed file1.txt > firstfile
./seder.sed file2.txt > secondfile
diff firstfile secondfile