The country code of Brazil is:
BFD
This is because:
The first letter of each code is the letter which begins the name of the country's capital - for Brazil this is BRASILIA, hence B.
The second letter of each code is the letter in the alphabetical position (i.e. A1Z26) corresponding to the number of letters in the country's name, as written in this list - for Brazil (6 letters), this is the 6th letter of the alphabet, F.
The third letter of the code is the A1Z26 coding corresponding to the number of colours in the country's flag. For Brazil, whose flag contains green, yellow, blue and white, this is the 4th letter of the alphabet, hence D.

Image source: Wikipedia
For a full explanation for each country in the original list, see the following table:
