Before entering the security line the bar code on your boarding pass is scanned, decoded, and checked against the traveler database. If any of the information does not match, you will be detained. The circles or lines that a TSA agent will draw on your boarding pass are part of a system to help the agent remember to check each piece of information, part of which is verifying it against the scanner.
The machine looks something like this http://ww3.hdnux.com/photos/01/64/47/477654/3/628x471.jpg