Galician language
It seems that a large number of viewers among those who can understand Spanish have some confusion as to the nature of the "funny dialect" the characters speak at times.
First of all, it is not a dialect. It is Galician language. And like Spanish, Catalan, Portuguese, French, Italian and Romanian, it is a Romanesque tongue.
The reason why the characters speak one language or another at times is because the story takes place in the Galician country. That is the north-western corner of Spain, where most of people speak the native language all the time even if they are fluent in Spanish. I was born and grew up there, and I speak both languages.
The film is trying to give a realistic picture of that part of the country and its people. Perhaps those viewers who scorn the local language were expecting to hear Argentinian Spanish instead?
Javier Bardem's accent is actually so good that he could pass perfectly for a Galician native, I give him that.