I wouldn't consider this really a grammar question, but more of a question of usage.
That aside, "speak" and "talk" are often interchangeable, that's true. Nevertheless, "speak" is a bit more formal than "talk". The President speaks before Congress. I talk to my friends on the phone.
We say that someone gives a speech when it's more formal, gives a talk when it's less formal.
When speaking we don't expect to be interrupted, conversational style, as much as when we are talking. In the more formal world of medicine, we may be diagnosed with a disease which impedes our ability to speak. In the less formal world of everyday conversation, we may say we can't talk too long, there are other things we have to do.
Also informally we can say that we talked the night away (were up all night talking), but it would be odd to hear that someone spoke the night away!
In phrasal verbs there are distinct differences. "speak up" is to speak louder or to stand up for what you believe in. "talk up" is completely different. It means to talk about the advantages of something in order to sway opinion in its favor.
Others will no doubt be able to add to what I have listed here.