As I understand it, formal groups within a firm are groups that are created officially by the management. You might have a task force that is formed to work on a given problem or you might have a permanent department with a set hierarchy.
By contrast, informal groups are not officially created. These are ad hoc groups that spring up based on who gets along with who, who has what kinds of shared interests, etc. These groups are harder for firms to control because they do not fit in the corporate hierarchy. But they are often a "place" where a lot of valuable work and networking goes on.
The more common terms used are formal and informal "organizations" rather than groups. Formal organization refers to the groupings of all he persons working for a firm in different divisions, department, sections, etc., that is formally defined and specified. The formal organization also defines haw the total work of the firm is divided among such different organizational units or groups and among persons within each group. The formal organization also determines the relationship between people within a group and across the group. These relationships are primarily in terms of boss-subordinate reporting relationships. Work within the enterprise is carried within the framework of formal organisation structure.
However the effectiveness of work within any firm is influenced significantly by informal organization that exists side by side with the formal one. The informal organization is not designed or implemented by any one purposely. It develops spontaneously because of interaction between people working together. The informal organizations is based on personal relationships that exists between people, rather than on work requirement. The primary purpose of informal organization is to serve the personal need of the people. However, it invariable impacts the basic work of the enterprise, and consequently its performance. For example, friendship between a sales person and someone working in production planning, may enable the sales person to get information on delivery commitments faster. This will help the sales effort of the company. However, this may also result the production planning person playing favourites in delivery of selected orders based on considerations of friendship. This may hurt the interest of the firm.
In view of statement made in the post above, it is desirable to clarify that neither the formal or informal groups need to be ad hoc. Also the informal relationships in firms tend to be longer lasting than the formal organization structures. Thus, though in some other settings ad hoc informal groups may form, in firms the informal organizational groups are not ad hoc.