What does the secure keyboard entry menu item in Terminal app do?
Essentially, this option prevents other applications (including things like TextExpander) from "listening in" on what you are typing. By preventing other background processes from recording or accessing your keystrokes, you are ensuring they cannot be logged or monitored, eg. by a simple keylogger, or another program running with normal permissions for potentially malicious purposes.