Question: In spoken conversations the grammar used is sometimes very different from the rules that we learn in textbooks or that apply to writing. This is even more so in regional dialects when sentences like

> 
> Das ist der Erich, dem wo seine Frau davongelaufen ist.
> 
> 
> 

are perfectly understood and spoken just like above.

How do we prepare to differentiate a regional grammar from official grammar rules when traveling to Germany?

Answer: 
It is not “wrong”. You might think that anything goes, but this kind of construction has to be very specific to pass as “locally correct”. If you don’t want to learn a particular dialect, you should speak with lots of different people which is a good idea in any case. But you will always pick up something local. There is no “pure” language.

So, my advice:

Speak with lots of different people.

Seek out situations that favour less use of dialect. (So maybe not in a village bar.)

Ask your native friends to take into account your need to learn regular grammar and tone down the local variants.
I think it would help you to take a look at this question:  

[In welchen Regionen ist die dem-sein-Form gebräuchlich?](https://german.stackexchange.com/questions/48/in-welchen-regionen-ist-die-dem-sein-form-gebrauchlich) 

Avoiding bad grammar is easier when you understand how the bad grammar works.