A .gramps XML file can be compressed or not. (Compressed by default, uncompressed is an option.) It includes all the tree data except Media objects. Like a GEDCOM 5.5.1 file, it just has pointers to where those files are stored. (The .gpkg or "Gramps package" files are ALWAYS compressed and you can choose to include the Media objects too.) None of the backup file formats include Gramps preferences, report configurations, custom filters or several other convenience settings.
.gramps and .gpkg files are used for backup or data exchange.
On the other hand, the native working format is a database file. (Before Gramps 5.0, this was normally a BSDDB database backend. After that, the application moved to SQLite as the default database backend.) Those files are stored by default in a sub-directory of the Gramps User Directory. (The location differs based upon which OS your machine uses. See https://gramps-project.org/wiki/index.php/Gramps_Glossary#user_directory ) The database directory can be changed in the Edit -> Preferences dialog.
Databases are, by their very nature, highly changeable and fragile. That is why backup to .gramps or .gpkg file is so pervasively recommended. There are automated/timed backup and backup upon exit preference option in addition to the manual backup features.
When you open a .gramps file from the desktop (where the Gramps application is set as the default for that file type), then Gramps will launch and import that backup file into a new tree. You create a parallel Tree with old data!! Worse, if you have Gramps open and try to open a .gramps file, it will IMPORT that old data into your open Tree... creating DUPLICATE records!!!
Do NOT open a .gramps file this way!