You could add local data filter if something like this what you are looking for

Graph Builder(
Size(528, 500),
Show Control Panel(0),
Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
Elements(Points(X(1), X(2), Y, Legend(10))),
Local Data Filter(
Add Filter(
columns(:age),
Where(:age == {13, 16}),
Display(:age, N Items(6))
)
)
);
Or if you are scripting, you can use Where
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(528, 500),
Show Control Panel(0),
Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
Elements(Points(X(1), X(2), Y, Legend(10))),
Where(Contains({13, 16}, :age))
);
-Jarmo