Is this sentence grammatically correct?
If the weather is going to be nice tomorrow, we'll have a picnic.
It is, I think, grammatically correct. For comparison, we might say:
"If you are going to study tomorrow, I will see you in the library" or "if Jane is going to be an actress when she grows up, we may see her on television"
However, your sentence is not the usual colloquial construction, which would run:
"If the weather is nice tomorrow, we'll have a picnic"
The distinction here is that the first two sentences, carry the idea that some decision has already been made - you have decided whether you will study tomorrow; Jane has said that she plans to be an actress. Both decisions are provisional and might be changed, but at least the idea is there that the decision is made, or might be made right now.
On the other hand, we do not know what the weather will be tomorrow. The likely idea is that we will wait until tomorrow, see what the weather is, and then decide about the picnic. Then "If the weather is nice tomorrow..." is the right construction.
Of course, you might have just seen a weather forecast, which unexpectedly told you, it will be fine tomorrow. Then "If the weather is going to be nice tomorrow, we'll have a picnic" is probably just what you want.