OSX has a security system that allows third party developers to develop authorisation plugins, in order to provide alternative or additional security, such as finger print scanners, iris readers or anything else you want to provide.
There's a database of rules which states for each type of security access, what security mechanisms are used. You can see this in action when you see the padlock icon in Security Preferences. Clicking on a locked icon brings up a security dialog asking for credentials.
The lock screen and login uses the same mechanism, so with this in mind, it's not too difficult to write a plugin which listens out for a network message (in this case, via bluetooth) from the iPhone, which is sent when the internal gyroscope picks up the knock.
Modifying the security rules database allows the developer to switch the standard login dialog for their security plugin and that's all there is to it.
As for being more secure, I'm not too sure about that; they are, after all, replacing the standard OSX security, which requires a password that is verified through Apple's cryptography.
If someone in your home picked up your iPhone, they can easily knock on it and unlock your Mac, but with a password, only you should know that!