Dynamic group formation and discovery is an important component of several emerging end system applications and network services including peer-to-peer and overlay systems, network storage/caching systems, and reliable multicast/distribution services. In our previous work, we proposed a programmable, scalable grouping service based on multicast and concast. In this paper, we present a generalized abstraction that subsumes the earlier service and can be implemented using other forms of network support in addition to (or apart from) multicast/concast. In designing the new grouping abstraction, we have attempted to separate the policies governing set formation from the network mechanisms (multicast, concast, distributed hash tables, etc.) used to implement those policies. In addition, we allow policies to be specified in terms of both application-specific criteria and networkbased criteria. We describe how the service can be used to solve grouping problems from different application areas, and give an example showing how it can leverage different network support mechanisms, including ephemeral state processing.