There is already a basic form of anti-malware built in, it's been there since 10.6:
http://www.pcmag.com/article2/0,2817,2352102,00.asp
It checks all downloaded software (through Safari/Mail/iChat etc) against a list of known malware signatures. If it finds a match, it lets you know exactly what's going on.
If you go to this path:
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.plist you can see the list, which includes OSX.RSPlug.A which had some notoriety a little while ago.
The OS is capable of knowing what is a trojan, so long as this is kept up to date as best as possible (yes, we all know new variants get released from time to time). If there was a better method to keep this up to date, Apple wouldn't have to release a full-blown security update like they're going to do, which no doubt will involve a lot more QA than adding a key to plist.
It's not making intelligent guesses about what programs do here, your keyloggers are safe, it relies on a list of known malware.