GMail Backup is an application which allows users to save their emails and restore if necessary. You will need to activate the IMAP access to your mailbox, to do so, please open your Gmail settings and under POP/IMAP tab activate this option.
The messages are stored in the local directory in files which names follow the format YYYYMMDD-hhmmss-nn.eml. In case there are more e-mails with the same timestamp there is the number nn which starts with value 1. Label assignment is stored in the file labels.txt which is the plain text file and it pairs the e-mails stored in the file described above with the assigned labels.