It happened automatically in my MacBook Pro (both early 2008 and mid-2012) without any third-party app installed. In other words, the volume can be set differently between internal speaker and headphones and my MBP remembers the different settings.
Macs have two volume settings: one for the internal speakers, and one for headphones/external speakers. Just plug in the headphones and adjust the volume to your liking. Now unplug and adjust the internal speakers to your liking. Your Mac will remember your settings.