Want to import already defined physical groups of Microstructure in Gmsh to FEnics

As Francesco said, the latter bit of the tutorial uses the data from gmsh directly.
The tags are read in with

with XDMFFile(MPI.COMM_WORLD, "mesh.xdmf", "r") as xdmf:
    mesh = xdmf.read_mesh(name="Grid")
    ct = xdmf.read_meshtags(mesh, name="Grid")
mesh.topology.create_connectivity(mesh.topology.dim, mesh.topology.dim - 1)
with XDMFFile(MPI.COMM_WORLD, "mt.xdmf", "r") as xdmf:
    ft = xdmf.read_meshtags(mesh, name="Grid")

and then converted to a dolfinx.fem.Function with:

Q = FunctionSpace(mesh, ("DG", 0))
kappa = Function(Q)
bottom_cells = ct.find(bottom_marker)
kappa.x.array[bottom_cells] = np.full_like(bottom_cells, bottom_marker, dtype=default_scalar_type)
top_cells = ct.find(top_marker)
kappa.x.array[top_cells] = np.full_like(top_cells, top_marker, dtype=default_scalar_type)

In summary, you just need to transfer the data from a MeshTags (in legacy dolfin MeshFunction) to a Function if you want to use the values of the markers in your variational form as parameters.

There are other ways of defining these sub domains (although I rarely use it), see for instance: https://fenicsproject.org/olddocs/dolfin/latest/python/demos/subdomains-poisson/documentation.html?highlight=subdomain_data