What relations and differences are between formal semantics for linguistics and for programming languages?
This question is very open-ended and therefore difficult to answer, but I think the short answer is &quot;yes&quot;, there is much common ground, the two areas have in fact benefited from interaction in the past, and they have much to gain from further interaction.
Two classical examples of this (respectively from the 1950s and '70s) are Lambek grammar and Montague grammar, which model different aspects of natural language using sequent calculus and lambda calculus (which have become cornerstones of programming language theory, with connections to category theory and type theory).
In relatively more recent history, personally I found Ken Shan's dissertation Linguistic side effects (2005) an inspiring exploration of the thesis that natural languages and programming languages have more common ground than differences.  To quote a bit from the introduction:

This dissertation is about computational linguistics, in two senses. First,we apply insights from computer science, especially programming-language semantics, to the science of natural languages. Second, we apply insights from linguistics, especially natural-language semantics, to the engineering of programming languages. The phrase “computational linguistics” has a popular third sense, which is natural-language processing: teaching computers to listen to, speak, read, and write natural language. That is not our aim, even though the research described here indirectly helps it—by enhancing our understanding of natural and programming languages.

Chris Barker has also written extensively about the concept of continuation from programming languages semantics and how it may be used to illuminate the nature of quantification in natural language, and the two have recently collaborated on a book which explores this topic further.