This is a great question, because it highlights one of the very common changes that occurs during pregnancy. It is important to discuss it with your OB GYN doctor
, who can help you with this issue. Heartburn increases during pregnancy for two different reasons. The first is that some of the hormones associated with the pregnancy cause the muscle between the esophagus and stomach to be more relaxed; this leads to acid more easily escaping out of the stomach and causing heartburn. The second reason is that, as the baby is growing, there is less and less room inside the abdomen, and the uterus starts to put pressure on the surrounding organs, such as the stomach.
The reason that you notice that the symptoms are worse with coffee or with tomatoes is that both of these foods also can contribute to relaxation of the muscle between the esophagus and stomach and they can also increase acid production in the stomach.
The most straight forward way to help with heartburn is to avoid the foods that you notice cause it. In your case these are at least tomatoes and coffee, and potentially others as well! It is also a good idea to talk to your OB GYN doctor who can help you decide whether medication to reduce stomach acid might also be needed.