What does Mail.app use to decide if an email is Junk Mail?
Mail.app uses more than one approach to junk mail.


Some spam gets reported by other users.


You can forward your junk mail to spam@icloud.com and it gets added to Apple's filtering system.

Mail servers sometimes mark messages as spam.


When a tool like spam assassin has marked an incoming message as junk, Mail.app respects that and passes it to the junk folder automatically.

Mail.app also supports custom filters.


You can make your own filters that will direct junk mail into the junk folder.