Proponents of Formalism and New Criticism think the analysis of literature should be focused on form. What makes a poem differ from prose? What makes all literature differ from ordinary language? They purposefully ignore things external to the text: things like authorial intent and historical context. This analysis also studies how literature is able to convey universal truths, which, being timeless, are not limited to any biographical or historical context.
These days, Formalist criticism is rarely done in isolation. Word choice in a poem ("she" rather than the historically universal "he") might reflect a growing awareness of gender equality. This introduces a cultural awareness—one that suits a structural analysis more than a formalist one. One of the ways that literary language differs from other language is that it can make the reader look at something (in life) in a new way. This, in formalist lingo, is called defamiliarization: the act of presenting ordinary things in a strange way. This is done through the use of literary (and some times experimental) language. Formalism is a disciplined look at literariness.
One of the main similarities between formalism and structuralism is the focus on how language works. Formalism studies how literary language communicates truths in stylistic or strange ("defamiliar") ways. Structuralism studies how language works in general and in a scientific way. The key figure here is Ferdinand de Saussure. He provided the logic of signification. A thing or idea is a "signified" and that thing or idea is represented by a visual or audible word called a "signifier." The signified/signifier relationship is called a "sign." Saussure believed that by understanding the rules governing signs, we could understand the laws that govern language in all cultural domains—not just literary domains. This is where structuralism differs from formalism.
Saussure saw structuralism as a much broader, audacious attempt at studying all aspects of culture by looking at language. But both formalism and structuralism share an intense interest in language itself and particularly "how" language works.
Formalism and structuralism are related in that they are both means of literary criticism that examine literature in terms of the text. Each disregards potential outside influences such as the author of the work and the historical context in which the work is produced. A formalist critique of a work of literature would focus on that work in and of itself. It would examine aesthetics, meaning, form, emphasizing "defamiliarization" and "literariness." A structuralist critique would examine the underlying universal structures of "test" and "signifying practices" in order to discern patterns that determine the system of signification (or more simply, patterns that underlie all communications in a given language). Enotes includes a helpful introduction to literary theory for reference.