It's a polite way to acknowledge the greeting and return the courtesy.
You can also use:
* "Bonjour à vous aussi" (Good morning to you too)
* "Bonjour madame/monsieur" (Good morning, madam/sir)
* "Bonjour, comment allez-vous?" (Good morning, how are you?)
The best choice depends on the context and your relationship with the person you're speaking to.