I think that you need to write your own regrouping algorithm. If it used only once in all application you can create it in view:
regrouped = {}
actions = Action.objects.all()
# be careful this implementation creates large amount of sql queries.
# you need to optimize it or cache it!
for action in actions:
country_key = '_'.join([country.pk for country in action.countries.all()])
if not country_key in regrouped:
regrouped[country_key] = {'countries': action.countries.all(), 'actions': []}
regrouped[country_key]['actions'].append(action)
And in template:
{% for key, item in regrouped.items %}
Countries: {% for country in item.countries %}{{ country }};{% endfor %}
Actions: {% for action in item.actions %}{{ action }};{% endfor %}
{% endfor %}