It does exactly as you suggested - it skips characters that are the same in both strings and compares the first different characters by code unit value. This is explained by the abstract relational comparison algorithm in the spec (emphasis added):
a. If py is a prefix of px, return false.
b. If px is a prefix of py, return true.
c. Let k be the smallest nonnegative integer such that the character at position k within px is different from the character at position k within py. (There must be such a k, for neither String is a prefix of the other.)
d. Let m be the integer that is the code unit value for the character at position k within px.
e. Let n be the integer that is the code unit value for the character at position k within py.
f. If m < n, return true. Otherwise, return false.