> if I set the background color on the table and the border color for the cell, the background color will be filled for the whole form which I don't want it to be
You just have to qualify which table section you want to modify by providing an appropriate selector:
$("<selector> table.formSection").css("background-color", "yellow");
$("<selector> table.formSection tr td").css("border-color", "yellow");
I don't know what
<selector> should be as it would be specific to your form.