A Naval Ensign is the flag used by a country's navy on their ships.
Some countries (like the United States) use the national flag as its Naval Ensign. Others (like the United Kingdom, South Africa, New Zealand) use a variant of the national flag as the naval ensign.
These flags are recognized as belonging to warships and strict regulations governing them are put in place by the navy's respective governments. Civilian ships - with very few exceptions - would not fly naval ensigns.
If a warship goes into battle, large versions of naval ensigns (called battle ensigns) would be raised on the ship's mainmast.