Identifying the type of a file is usually done by looking at the file extension.
.zip: compressed archives in zip format.
.doc: Words files.
Sometimes the extension does not match, or the file does not have one.
The 'file' command examines the contents of the file, looking for well known headers.