When you open a file, the file manager performs the default action for that file type.
For example, opening a music file will play it with the default music playing application, opening a text file will enable you to read and edit it in a text editor, and opening an image file will display the image.
The file manager checks the contents of a file to determine the type of a file. If the first lines do not determine the type of the file, then the file manager checks the file extension.