Well, in these particular cases I think both sound a bit awkward. What you have here in the second clause is (I think) what linguists call pseudogapping, which is a type of verb phrase ellipsis (i.e., the verb in the antecedent clause is left out of the second clause). Sometimes when you leave the verb out of a clause you use "so" as a kind of stand in for the complement or adjunct of the verb (i.e., what comes to the right of the verb in the first clause). In this case, I think "that" and "it" are stand-ins for "when a phrase is informal", but as I said normally in English you would prefer to use "so" for that.
Note that these examples aren't ungrammatical. But they do sound, to my ear, typical of second language English. Not that there's anything wrong with that.
As for the distinction in general between "do it" and "do that", it's subtle. "It" is a pronoun, and as such when you use it you are signaling that you are referring back to something which has already been talked about or somehow referred to in the discourse. (In other words, I can point to something and say "Do it!" and that would be enough.) "That" is a word which you use to point out a particular thing in the world (the technical term is "deixis"), as such "that" is a better choice when you are distinguishing or contrasting one thing from something else.