Covering codes
Put all the mistakes in one basket
It seems you cannot beat 1/2 here: each person guesses right with chance 1/2. But the rule "if I see two alike, I name the other colour, otherwise I pass" wins in 6 hat sets out of 8, a 3/4 chance. It loses only when all three hats match, and then all three are wrong together.
Each guess is right in one hat set and wrong in the neighbouring one where only that hat differs. So right and wrong guesses come in equal numbers. A win needs just one right guess, and one losing set can soak up as many as n wrong ones. Hence the bound: the chance is at most n/(n + 1). For n = 3 that is 3/4, and a full search over all 81³ = 531,441 combinations of rules confirms that nothing does better.
For n = 2m − 1 the bound is reached by the Hamming code, the same one as in the poisoned wine puzzle: 7 players win in 112 of 128 hat sets (7/8), 15 players in 30,720 of 32,768 (15/16). Each player checks whether the hats could form a codeword, and if so names the colour that breaks it.