Overriding the output for the primary navigation links
That syntax (two underscores) means that it first looks for a theme_links__system_main_menu()theme function and then falls back to theme_links() if that doesn't exist.

So to override only the main menu, create the following theme function for your theme: yourtheme_links__system_main_menu().