Get the group
SPGroup group = web.SiteGroups["GROUP_NAME"];
Create a role assignment
SPRoleAssignment newRoleAssignment = new SPRoleAssignment(group);
Add the role definition (Full Control, Read, Contribute, …) to the role assignment
newRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions["Full Control"]);
And add the role assignment to the web
web.RoleAssignments.Add(newRoleAssignment);