1. He works in a company.

=> The emphasis is on
works, the action, what he does in the company.
2. He works on a company.
3. He works for a company.

=> As opposed to, say, works for himself.
4. He works at a company.

=> The emphasis is on
a company, the place, location.
Does that help?