So, a redstone comparator in comparison mode (front torch down and unpowered) compares its rear input to its two side inputs. If either side input is greater than the rear input, the comparator output turns off. When the front torch is powered, you use it to measure the amount of a tile entity. For example, a lectern. Let's say the book on the lectern was flipped to page 14. With the torch powered, the comparator would measure the book page, in this case 14, and release a redstone signal. So, in this case its page 14, so its a redstone signal of 14.