Out of the box what you’ve described isn’t possible, as shipping methods just look at the totals for orders, and calculates rates accordingly.
But the idea is that you’d be able to achieve this by developing your own shipping methods, ones that can do whatever they need to (so look at groups or attributes), to work out rates, whether they are offered, etc.
Both the built in shipping methods are good examples, but there’s also:
And some doco here:
https://concrete5-community-store.github.io/community_store/developers/shipping_methods.html
What you’d be aiming to do is putting some logic in the isEligible
function, which determines whether that shipping method can be offered with the current order items.
The logic challenge I see here though is what happens when someone puts both kinds of products into their cart? Does it just fall back to standard delivery?