A formal sanction is an action that is officially imposed against a group or organization to discourage its actions. An informal sanction is an individual action that's taken due to a perceived wrong.
Sanctions are most often observed on the international political scene. When one government strongly disagrees with another, it may oppose sanctions against that government as a way of trying to force it to conform. Trade embargoes are the most common way for governments to impose sanctions against offending nations. Whether formal or informal, sanctions are a way of singling out offenders.
An example of informal sanctions is a boycott. Although boycotts are typically actions taken en masse, they entail individual decisions to forego a product or service in response to an objection to it. Sanctions may or may not affect the intended target. In regard to formal sanctions, the people most affected are usually not the intended targets but bystanders. Informal sanctions, on the other hand, are a way of expressing individual dissatisfaction. Because they take place on a smaller scale, it is easier to send a targeted message. Though sanctions are a form a persuasion, not all targets of sanctions, either formal or informal, choose to conform as the result of the sanctions imposed upon them.