What is an anti-spam filter?
As it's name says, an anti-spam filter is responsible of filtering the spam or advertising/massive e-mails sent to your e-mail account.
In order to filter them, multiple check methods are applied to the message content (included links, offensive words, etc.) as well as to the subject and sender, with this data it's possible to determinate if a received e-mail is legit or if it's some kind of advertising or junk mail.