Spotlight is the search technology Apple introduced with Tiger. To make a long story short, every file—and email message—on your hard disk is indexed automatically as it’s created or modified. You can then search this index very quickly—much more rapidly than with the older techniques that required the computer to search the original data.
Spotlight also keeps track of metadata—data about data. For ordinary files, this information includes things like size and modification date; for photos, metadata might include exposure information and the type of camera used to take the picture. Although Mail doesn’t make the most of Spotlight’s metadata capabilities, an add-on called MailTags (see Search Metadata with MailTags