I think what you want is a custom tooltip. There is also a whole custom tooltip window thing but that may be a bit overkill for what you want. I’ve achieved this with Pango markup

Code is just hello world with a few extra lines;
#include <gtk/gtk.h>
gboolean
query_tooltip (
GtkWidget* self,
gint x,
gint y,
gboolean keyboard_mode,
GtkTooltip* tooltip,
gpointer user_data
){
gtk_tooltip_set_markup(tooltip, "<span foreground=\"blue\" background=\"red\">Blue text over red background</span>");
return TRUE;
}
static void
activate (GtkApplication *app,
gpointer user_data)
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *button_box;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (window), button_box);
button = gtk_button_new_with_label ("Hello World");
gtk_container_add (GTK_CONTAINER (button_box), button);
/*
* Set "has-tooltip" to true and connect it's signal
*/
gtk_widget_set_has_tooltip(button, TRUE);
g_signal_connect(G_OBJECT(button), "query-tooltip", G_CALLBACK(query_tooltip), NULL);
gtk_widget_show_all (window);
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}