I think your entire logic would be simplified if you could write a method such as:

  static int trimTrailingWhitespace(int ptr, byte[] raw)

and use that to correct ae and be above before you even start the main compare while loop.  Then when the compare is done, you don't need to worry about checking for tailing space on the end.

Its not very common to have trailing spaces on the end of lines.  Prefiltering the line to trim it off will be mostly a no-op, or at most, one CR in a CRLF file, so very trivial.  Even if we break out on the first non-space character compare, its probably not a huge hit that we prefiltered ae,be at the start.

Likewise, you can simplify the code with a trimLeadingWhitespace method that prefilters as,bs before the main while loop starts.  Then you know you are looking at a non-whitespace character at the start of the while loop, and only need to skip over whitespace characters after the first non-whitespace.  Which, that code should share a lot of similarity with trimLeadingWhitespace.  Possibly making my performance-nit above not very desirable to implement.