From the wiki page on comparators:
1. The redstone comparator can take a signal strength input from its rear as well as from both sides. Side inputs are only accepted from
redstone dust,
redstone repeaters, and other comparators. The redstone comparator's front is its output.
2. The redstone comparator has four functions: maintain signal strength, compare signal strength, subtract signal strength, and measure certain block states (primarily the fullness of containers).
3. A redstone comparator in comparison mode (front torch lowered and non-powered) will compare its rear input to its two side inputs. If either side input is greater than the rear input, the comparator output turns off. If neither side input is greater than the rear input, the comparator simply outputs the same signal strength as its rear input.
4. A redstone comparator in subtraction mode (front torch elevated and powered) will subtract the signal strength of the highest side input from the signal strength of the rear input (minimum 0 signal strength).
For example, if the rear input signal strength is 7, the left side is 2, and the right side is 4, then the output will be a signal strength of 3, because 7 - MAX(2,4) = 3.
So the side input can either be a "threshold" or a "subtraction", and that feature is independent of the "container size" rear input
(and this doesn't touch on the "maintain output" behavior, which just propagates a signal without any distance weakening or repeater strengthening.)