Freedom of navigation is a right of countries. Spanish ships have the right to freely traverse the seas next to Greece, etc. So ships have to identify themselves as belonging to a country so that they can benefit from it.