The concept of discourse is central to Michel Foucault's philosophy and social thought. According to Foucault discourse is defined by any type of activity of communication and representation (verbal or otherwise) that is conditioned and constrained by a set of explicit and implicit rules that enable any activity and at the same time limit it (it can be compared with Thomas Kuhn's notion of paradigm in science). The system of discourse structures the manner in which we perceive reality, it determines what constitutes right or wrong , defines the range of possible utterances in speech and representation, underlies any capacity to understand or argue, allocates the right to speak and in fact governs over everything that can and cannot be said or know. According to Foucault discourse is a historical and social product that like language appears synchronically and evolves diachronically (see article on de Saussure's thoughts on language).
Unlike ideology in the Marxist tradition, Foucault's concept of discourse does not originate from one defined source of power or social strata, it does not have one specific goal or purpose and there isn't one single function that rules over it. Discourse is not governed by the state (though totalitarian regimes definitely aspired to such control). Like ideology (especially in Althusser's views on ideology), discourse for Foucault have material existence in the shape of elaborate practices that are governed by the discourse while at the same time generate it. For Foucault discourse can be both positive and negative, repressive and liberating. Everyone of us is the subject of discourse and therefore a part in its construction. In any case, for Foucault there is no social (or even human) existence outside of discourse. Discourse shapes identities, thoughts, wants and needs, positions, normality and abnormality and it manifests itself in every part of our daily life.
More about Foucault:
Michel Foucault: Panopticism - Summary
Foucault's Panopticism explained
Michel Foucault and Marxism
Michel Foucault - ""The History of Sexuality"
Foucault, Structuralism and post-structuralism