To make bechamel, melt butter in a saucepan over medium heat. Whisk in flour. Add milk; bring to a simmer. Cook, whisking frequently, until sauce thickens, about 5 minutes. Remove from heat. Add 3 ounces grated Gruyere. Whisk until melted and smooth. Season with salt and pepper.
Preheat oven to 450 degrees. Spread butter on one side of each bread slice and place, buttered side up, on a rimmed baking sheet. Bake until tops are barely golden brown, 8 to 10 minutes. Switch oven to broil and place rack six inches from flame.
Spread mustard on untoasted sides of half of the bread slices. Top with a sprinkle of grated cheese, a slice of ham, and then another sprinkle of grated cheese. Top with another piece of bread, toasted side up. Spread 1 teaspoon bechamel evenly on top, and then sprinkle a teaspoon of grated cheese over the sauce. Repeat to make 12 sandwiches. Broil in 2 batches, 1 to 2 minutes, until tops are golden brown and bubbly.