I have seen this happen multiple times and it has always left me confused. The opposite alliance had one player short and placed 5 defenders less. If they had placed those 5 defenders then our ally would have gotten the attack bonus of taking out those defenders. But the opposite ally just got deducted 150 points for diversity and we ended up losing a war.
I understand I may be missing something basic here. I just want to understand what happens in these scenarios so that I can help my ally understand this as well.