BGM filenames are formatted with a 1 to 2 character code denoting franchise, followed by the source game, and (Japanese) song title. In Brawl, the code for each franchise was a single letter, A-Z. Pac-Man and Mega Man also follow this standard, with Mega Man taking the code previously occupied by Metal Gear (S) and Pac-Man taking the unoccupied V. Mario and the misc categories also has so many songs that starting in Ultimate, Mario songs use the codes A and AA, and Misc uses R and RR. The codes Q and R were used in Brawl for Retro Nintendo, and Miscelaneous Nintendo, respectively. All Nintendo franchises added in Smash 4 have their music put under Q or R. For example, Duck Hunt and Punch-Out music not from Punch-Out Wii are under Q, while Xenoblade, Wii Fit, and Punch-Out Wii go under R. Animal Crossing already had its own section in Brawl, that being N.
Starting with DLC third party franchises in Smash 4, the letter codes started to be phased out because there aren't enough letters in the alphabet to keep using this standard. Here are all the franchises that use abnormal codes:
AD - Castlevania (based on the Japanese title of Akumajou Dracula)
AM - ARMS
BK - Banjo-Kazooie
BY - Bayonetta
CRS - Smash 4
CRS2 - Smash Ultimate (In Brawl, Smash original music was split into several categories.)
DQ - Dragon Quest
FF - Final Fantasy
GD - All SNK Music (based on the Japanese name for Fatal Fury, Garou Densetsu)
MC - Minecraft
MG - Metal Gear (Interestingly, all numbers are identical to Brawl's data, including the gaps for the cut MGS Main Theme)
MH - Monster Hunter
PS - Persona
SF - Street Fighter
SP - Splatoon
Megalovania, Floral Fury, and other third party songs in Other are filed under R. This makes Monster Hunter the only third party franchise to not have a playable character to follow the naming convention.